package com.chixing.ih.module.programmer.mapper;

import com.chixing.ih.common.IhRepository;
import com.chixing.ih.module.programmer.mapper.provider.WorkMapperProvider;
import com.chixing.ih.module.programmer.pojo.Work;
import org.apache.ibatis.annotations.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘岩
 * Date: 2020-09-25
 * Time: 19:37
 *
 * @version 1.0
 */
@Mapper
public interface WorkMapper extends IhRepository<Work> {


    @UpdateProvider(type = WorkMapperProvider.class, method = "updateOne")
    int updateOne(Work work);

    @SelectProvider(type = WorkMapperProvider.class, method = "getOneById")
    @Results(id = "workMap", value = {
            @Result(id = true,column = "user_id", property = "programmerId"),
            @Result(column = "working_day_begin_time", property = "WDBT"),
            @Result(column = "working_day_end_time", property = "WDET"),
            @Result(column = "weekend_working_begin_time", property = "WWBT"),
            @Result(column = "weekend_working_end_time", property = "WWET"),
            @Result(column = "weekly_time", property = "weeklyTime"),
            @Result(column = "work_way", property = "workWay"),
            @Result(column = "region_province", property = "regionProvince"),
            @Result(column = "region_city", property = "regionCity"),
            @Result(column = "salary", property = "salary"),
            @Result(column = "work_status", property = "workStatus"),
            @Result(column = "create_time", property = "createTime"),
            @Result(column = "update_time", property = "updateTime"),
            @Result(column = "is_deleted", property = "isDeleted")

    })
    Work getOne(long programmerId);

    @InsertProvider(type = WorkMapperProvider.class, method = "insertOne")
    int insertWork(long userId);

}
